import { PageModalService } from './../../shared/service/page-modal-service';
import { AppGlobalService } from '../../shared/service/app-global.service';
import { HttpService } from '../../shared/service/http.service';
import { ActivatedRoute, Router } from '@angular/router';
import { Component, Input, OnInit } from '@angular/core';
import { ActionSheetService } from 'ng-zorro-antd-mobile';
//tslint:disable
@Component({
  selector: 'app-img-link-btn',
  templateUrl: './img-link-btn.component.html',
  styleUrls: ['./img-link-btn.component.scss'],
})
export class ImgLinkBtnComponent implements OnInit {
  @Input() tagData;

  inviteCode: any;
  clientType: any;
  buttonlinks: any;
  btnTitle: any;
  supplierLink: any;
  user: any;
  code: any;
  staffType = [];
  isApp = false;
  constructor(
    private router: Router,
    private httpService: HttpService,
    private _actionSheet: ActionSheetService, // 必须有
    private route: ActivatedRoute,
    private appGlobalService: AppGlobalService,
    private pageModalService: PageModalService,
  ) { }

  ngOnInit() {
    if (localStorage.getItem('client') === 'APP') {
      this.isApp = true;
    } else {
      this.isApp = false;
    }
    if (this.buttonlinks !== undefined) {
      this.buttonlinks.forEach(element => {
        if (element.link && element.link.params && element.link.params.h5) {
          this.staffType.push({ name: element.link.params.label, value: element.link.params.value });
        }
      });
    }
   
  }


  
  phone(phone) {
    this.httpService.changeCallNumber(phone);
  }
  supplierClick() {
    this.pageModalService.openPage(this.supplierLink);
  }


  // 跳转页面
  goPage(link) {
    this.pageModalService.openPage(link);
  }

  checkArray(obj) {
    return Array.isArray(obj);
  }

}
